import { ls } from '../storage'

export const TOKEN = 'common.token'
export const SOCKETTOKEN = 'common.socketToken'
export const USERINFO = 'common.userInfo'
export const HASLOGIN = 'common.hasLogin'

const commonModule = {
  token: {
    get() {
      return ls.get(TOKEN)
    },
    set(value) {
      return ls.set(TOKEN, value)
    },
    remove() {
      ls.remove(TOKEN)
    }
  },
  userInfo: {
    get() {
      return ls.get(USERINFO)
    },
    set(value) {
      return ls.set(USERINFO, value)
    },
    remove() {
      ls.remove(USERINFO)
    }
  },
  hasLogin: {
    get() {
      return ls.get(HASLOGIN)
    },
    set(value) {
      return ls.set(HASLOGIN, value)
    },
    remove() {
      ls.remove(HASLOGIN)
    }
  }
}

export default commonModule
